const express = require('express')

const app = express()

app.set('secret', 'hfsdajfioj')

app.use(require('cors')())  //跨域
app.use(express.json())     //处理数据

// 静态文件目录
app.use('/uploads', express.static(__dirname + '/uploads'))
app.use('/admin', express.static(__dirname + '/public/admin'))
app.use('/', express.static(__dirname + '/public/web'))

require('./plugins/db')(app)
require('./routes/admin')(app)
require('./routes/web')(app)

app.listen(3000, () => {
  console.log("port 3000 is running...");
})